package com.wslds.blog.action.admin;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.wslds.base.action.AbstractCRUDAction;
import com.wslds.bean.Imgtype;
import com.wslds.blog.service.ImgtypeService;

@SuppressWarnings("serial")
@Component("imgtypeAdminAction")
@Scope("prototype")
public class ImgtypeAction extends AbstractCRUDAction<Imgtype, ImgtypeService>{

	@Override
	@Resource(type=ImgtypeService.class)
	public void setService(ImgtypeService service) {
		this.service = service;
	}
	
	public String listAlbum() throws Exception{
		try{
			List<Imgtype> list = service.find("imgtype", instance);
			this.put("list", list);
		}catch (Exception e) {
			return ERROR;
		}
		return SUCCESS;
	}

	public String add() {
		this.put("imgtypeList", service.find("imgtype", null));
		return super.add();
	}
	
	public String edit() {
		this.put("imgtypeList", service.find("imgtype", null));
		return super.edit();
	}
	
}
